package cn.fintecher.pangolin.service.manage.repository;

import cn.fintecher.pangolin.entity.mysql.ContactConfig;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

import java.util.List;

/**
 * @Auther: xiaqun
 * @Description:
 * @Date: 10:54 2019/9/12
 */
public interface ContactConfigRepository extends JpaRepository<ContactConfig, String>, QuerydslPredicateExecutor<ContactConfig> {
    /**
     * 查询没有联络配置的委托方
     */
    @Query(value = "select id,name,phone from principal where id not in (select principal_id from contact_config where level = 1 and status = 'ON')", nativeQuery = true)
    List<Object[]> getPrincipalNoConfig();
}
